import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
      song:{},//添加状态信息，需要通过mutations里面改变
      zhuanji:{}
  },
  mutations: {//改变state里面的状态
      setSinger(state,song){//构造函数
          state.song = song
      },
      setZhuanji(state,zhuanji){
        state.zhuanji = zhuanji
      }
  },
  getters:{
    song:state => state.song,//等价于 singer:(state)=>{return state.singer}
      // singer:(state)=>{return state.singer}
      zhuanji:state => state.zhuanji
  },
  actions:{

  },
  modules:{

  }
})

export default store //输出语句，以便使用


